<extend name="Public:base" />
<block name="title"><title>角色管理</title></block>

<block name="script">
	<script type="text/javascript">
		$(document).ready(function(){
			$('#collapseTwo').addClass('in');
			$('#collapseOne').removeClass('in');
			$('#myTab a:first').tab('show');
		});
	</script>
</block>

<block name="sidebar">
	<include file="Public:sidebar" />
</block>

<block name="content">
	<div id="content" class="col-sm-8">
		<ul class="nav nav-tabs" id="myTab">
			<li><a href="#index" data-toggle="tab">角色列表</a></li>
			<li><a href="#roleAdd" data-toggle="tab">添加角色</a></li>
		</ul>

		<!-- Tab panes -->
		<div class="tab-content">
			<div class="tab-pane fade in active" id="index">
				<table class="table table-hover table-bordered table-condensed">
					<tr>
						<td>序号</td>
						<td>角色名称</td>
						<td>角色描述</td>
						<td>状态</td>
						<td>操作</td>
					</tr>
					<volist name="list" id="vo">
						<tr>
							<td>{$i+$num}</td>
							<td>{$vo['name']}</td>
							<td>{$vo['remark']}</td>
							<td>
								<if condition="$vo['status'] eq 1"><span class="label label-success"><i class="glyphicon glyphicon-ok"></i></span>
								<else />
									<span class="label label-danger">							
									<i class="glyphicon glyphicon-remove"></i></span>
								</if>
							</td>
							<td>
								<div class="btn-group btn-group-xs">
									<a class="btn btn-primary" href="{:U('Role/accessList',array('id'=>$vo['id'],'name'=>$vo['title']))}">权限设置</a> 
								 	<a class="btn btn-info" href="{:U('Role/user',array('id'=>$vo['id'],'name'=>$vo['title']))}">成员管理</a> <a class="btn btn-warning" href="{:U('Role/edit', array('id'=>$vo['id']))}">修改</a> 
								 	<if condition="$vo['status'] eq 1">
								 		<a class="btn btn-danger" href="{:U('Role/forbid', array('id'=>$vo['id']))}">禁用</a>
									<else />
										<a class="btn btn-default" href="{:U('Role/resume', array('id'=>$vo['id']))}">恢复</a>
									</if>
								</div>
							</td>
						</tr>
					</volist>
					<tr><td colspan='5'>{$page}</td></tr>
				</table>
			</div>
			<div class="tab-pane fade" id="roleAdd">
				<form class="form-horizontal" action="{:U('Role/insert')}" method='post'>
					<div class="form-group">
						<label for="name" class="col-sm-2 control-label">角色名称:</label>
						<div class="col-sm-5">
							<input type="text" class="form-control" placeholder="角色名称" name="name" id="name" />
						</div>
						<label class="col-sm-2 control-label"></label>
					</div>						
					<div class="form-group">
						<label for="remark" class="col-sm-2 control-label">角色描述:</label>
						<div class="col-sm-5">
							<input type="text" class="form-control" placeholder="角色描述" name="remark" id="remark" />
						</div>
						<label class="col-sm-2 control-label"></label>
					</div>						
					<div class="form-group">
						<label class="col-sm-2 control-label">是否启用:</label>
						<div class="btn-group col-sm-5" data-toggle="buttons">
							<label class="btn btn-primary">
								<input type="radio"  name="status" id="status" checked="checked" value="1" />启用
							</label>

							<label class="btn btn-danger">
								<input type="radio"  name="status" id="status" value="0" />禁用
							</label>
						</div>
						<label class="col-sm-2 control-label"></label>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label"></label>
						<div class="col-sm-5">
							<button type="submit" class="btn btn-success btn-add">添加</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</block>
